<script setup>
    import router from '../router'
// function a(){
//   console.log(router.currentRoute.value.path);
// }
</script>

<template>
  <div class="nav">
    <el-menu
    :default-active="router.currentRoute.value.path"
    class="el-menu-demo"
    mode="horizontal"
    :router="true"
    :ellipsis="false"
    
  >
  <div class="logo">
      <img src="../assets/logo.png" alt="">
    <h1>简约博客</h1>
  </div>
    <div class="flex-grow" />
    <el-menu-item index="/">
        <el-icon><HomeFilled /></el-icon>
        首页
    </el-menu-item>
    <el-menu-item index="/creation">
        <el-icon><Edit /></el-icon>
        创作中心
    </el-menu-item>
    <el-menu-item index="/message">
        <el-icon><Comment /></el-icon>
        消息中心
    </el-menu-item>
    <el-sub-menu index="/user">
      <template #title>
        <el-icon><UserFilled /></el-icon>个人中心
    </template>
      <el-menu-item index="/user">个人信息</el-menu-item>
      <el-menu-item index="/account">账号</el-menu-item>
      <el-menu-item index="/exitLogin">退出</el-menu-item>

      <!-- <button class="exit" @click="exitLogin()">退出</button> -->
    </el-sub-menu>
  </el-menu>
  </div>
</template>

<style lang="less" scoped>

.logo {
    display: flex;
    cursor: pointer;
    margin-left: 25px;
    height: 100%;
    img {
        height: 55px;
        margin-right: 10px;
    }
    h1{
        line-height: 50px;
    }
    
}
.flex-grow {
  flex-grow: 1;
}
.el-menu--horizontal{
    position: fixed;
    z-index: 5;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 5px 20px -4px rgba(0, 0, 0, 0.5);
}
.el-menu-item *[data-v-87036fcb]{
    width: 20px;
}
</style>
<style>
.exit{
  padding: 10px;
  cursor: pointer;
  text-align: left;
  background-color: #fff;
  width: 200px;
  border: none;
}
.exit:hover {
  color: #79bbff;
  background-color: #ecf5ff;
}
</style>